package com.example.myapplication;

import java.io.Serializable;

public class TargetMsg implements Serializable {
    private boolean isAuto = false;
    private boolean isRandom = false;
    private boolean isLaunch = false;
    private boolean isRetrieve = false;
    private int Yaw = 0;
    private int Pitch = 0;
    private int Distance = 0;

    public TargetMsg() {
        this.isAuto = false;
        this.isRandom = false;
        this.isLaunch = false;
        this.isRetrieve = false;
        this.Yaw = 0;
        this.Pitch = 0;
        this.Distance = 0;
    }

    public boolean getAuto() {
        return this.isAuto;
    }

    public void setAuto(boolean isAuto) {
        this.isAuto = isAuto;
    }

    public boolean getRandom() {
        return this.isRandom;
    }

    public void setRandom(boolean isRandom) {
        this.isRandom = isRandom;
    }

    public boolean getLaunch() {
        return this.isRandom;
    }

    public void setLaunch(boolean isLaunch) {
        this.isLaunch = isLaunch;
    }

    public boolean getRetrieve() {
        return this.isRetrieve;
    }

    public void setRetrieve(boolean isRetrieve) {
        this.isRetrieve = isRetrieve;
    }

    public int getYaw() {
        return this.Yaw;
    }

    public void setYaw(int Yaw) {
        this.Yaw = Yaw;
    }

    public int getPitch() {
        return this.Pitch;
    }

    public void setPitch(int Pitch) {
        this.Pitch = Pitch;
    }

    public int getDistance() {
        return this.Distance;
    }

    public void setDistance(int Distance) {
        this.Distance = Distance;
    }

    public byte[] toBytes() {
        byte[] byteArray = new byte[7];
        byteArray[0] = (byte) (isAuto ? 1 : 0);
        byteArray[1] = (byte) (isRandom ? 1 : 0);
        byteArray[2] = (byte) (isLaunch ? 1 : 0);
        byteArray[3] = (byte) (isRetrieve ? 1 : 0);
        byteArray[4] = (byte) Yaw;
        byteArray[5] = (byte) Pitch;
        byteArray[6] = (byte) Distance;
        return byteArray;
    }

    /**
     * Define frame 2 0 0 0 0 0 0 is get new state data from server
     *
     * @return [2 0 0 0 0 0 0]
     */
    static byte[] getRefresh() {
        byte[] byteArray = {2, 0, 0, 0, 0, 0, 0};
        return byteArray;
    }

}
